let storage = {
  /**
   * 存储
   * @param key
   * @param value
   */
  set: function (key, value) {
    if (typeof (Storage) !== 'undefined') {
      localStorage.setItem(key, value)
    } else {
      console.log('抱歉！您的浏览器不支持 Web Storage ...')
    }
  },
  /**
   * 获取数据
   * @param key
   * @returns {string}
   */
  get: function (key) {
    if (typeof (Storage) !== 'undefined') {
      return localStorage.getItem(key)
    } else {
      console.log('抱歉！您的浏览器不支持 Web Storage ...')
      return ''
    }
  },
  /**
   * 移除数据
   * @param key
   */
  remove: function (key) {
    if (typeof (Storage) !== 'undefined') {
      localStorage.removeItem(key)
    } else {
      console.log('抱歉！您的浏览器不支持 Web Storage ...')
    }
  },
  /**
   * 全部清空数据
   */
  clear: function () {
    if (typeof (Storage) !== 'undefined') {
      localStorage.clear()
    } else {
      console.log('抱歉！您的浏览器不支持 Web Storage ...')
    }
  }
}

export default storage
